package com.design.work441;

import javax.swing.*;
import java.awt.Color;
public class BusinessMediator {
    private HotelGUI hotelGui;
    private AirlineGUI airlineGui;
    private TourGUI tourGui;
    private TouriststoreGUI touriststoreGui;

    public void registerHotelGUI(HotelGUI hg) {
        hotelGui = hg;
    }

    public void registerAirlineGUI(AirlineGUI ag) {
        airlineGui = ag;
    }

    public void registerTourGUI(TourGUI tg) {
        tourGui = tg;
    }

    public void registerTouriststoreGUI(TouriststoreGUI tsg) {
        touriststoreGui = tsg;
    }

    public void addAllCandidateCus(String option, String text) {
        if (option.compareTo(AirlineGUI.AIR) == 0) {
            hotelGui.addCandidateCustomer(text);
            tourGui.addCandidateCustomer(text);
            touriststoreGui.addCandidateCustomer(text);
        } else if (option.compareTo(HotelGUI.HOTEL) == 0) {
            airlineGui.addCandidateCustomer(text);
            tourGui.addCandidateCustomer(text);
            touriststoreGui.addCandidateCustomer(text);
        } else if (option.compareTo(TourGUI.TOUR) == 0) {
            hotelGui.addCandidateCustomer(text);
            airlineGui.addCandidateCustomer(text);
            touriststoreGui.addCandidateCustomer(text);
        } else if (option.compareTo(TouriststoreGUI.TOURISTSTORE) == 0) {
            hotelGui.addCandidateCustomer(text);
            airlineGui.addCandidateCustomer(text);
            tourGui.addCandidateCustomer(text);
        }
    }

    public void updateALlGuis(String option, String text) {
        if (option.compareTo(AirlineGUI.AIR) == 0) {
            hotelGui.displayInfoToScreen(text);
            tourGui.displayInfoToScreen(text);
            touriststoreGui.displayInfoToScreen(text);
        } else if (option.compareTo(HotelGUI.HOTEL) == 0) {
            airlineGui.displayInfoToScreen(text);
            tourGui.displayInfoToScreen(text);
            touriststoreGui.displayInfoToScreen(text);
        } else if (option.compareTo(TourGUI.TOUR) == 0) {
            hotelGui.displayInfoToScreen(text);
            airlineGui.displayInfoToScreen(text);
            touriststoreGui.displayInfoToScreen(text);
        } else if (option.compareTo(TouriststoreGUI.TOURISTSTORE) == 0) {
            hotelGui.displayInfoToScreen(text);
            airlineGui.displayInfoToScreen(text);
            tourGui.displayInfoToScreen(text);
        }
    }
}
